package com.example.game.sdk.framework

import android.app.Activity
import android.app.Application
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.os.Bundle
import android.view.KeyEvent
import org.json.JSONObject

object GameSDK {

    /**
     * 生命周期函数 application 调用
     */
    @JvmStatic
    fun attachBaseContext(context: Context) {
        GameSDKInternal.attachBaseContext(context)
    }

    /**
     * 生命周期函数 application 调用
     */
    @JvmStatic
    fun onAppCreate(app:Application){
        GameSDKInternal.onAppCreate(app)
    }

    /**
     * sdk初始化
     * @param params 初始化参数
     * @param callback 初始化回调
     */
    @JvmStatic
    fun init(params: JSONObject, callback: GameApiCallback) {
        GameSDKInternal.init(params,callback)
    }
    @JvmStatic
    fun onCreate(activity: Activity,savedInstanceState: Bundle?){
        GameSDKInternal.onCreate(activity,savedInstanceState)
    }

    @JvmStatic
    fun onStart(activity: Activity){
        GameSDKInternal.onStart(activity)
    }

    @JvmStatic
    fun onResume(activity: Activity){
        GameSDKInternal.onResume(activity)
    }

    @JvmStatic
    fun onPause(activity: Activity){
        GameSDKInternal.onPause(activity)
    }

    @JvmStatic
    fun onStop(activity: Activity){
        GameSDKInternal.onStop(activity)
    }

    @JvmStatic
    fun onDestroy(activity: Activity){
        GameSDKInternal.onDestroy(activity)
    }

    @JvmStatic
    fun onRestart(activity: Activity){
        GameSDKInternal.onRestart(activity)
    }

    @JvmStatic
    fun onActivityResult(activity: Activity,requestCode: Int, resultCode: Int, data: Intent?){
        GameSDKInternal.onActivityResult(activity,requestCode,resultCode,data)
    }
    @JvmStatic
    fun onRequestPermissionsResult(
        activity: Activity,
        requestCode: Int,
        permissions: Array<out String?>,
        grantResults: IntArray
    ){
        GameSDKInternal.onRequestPermissionsResult(activity,requestCode,permissions,grantResults)
    }

    @JvmStatic
    fun onConfigurationChanged(activity: Activity,newConfig: Configuration){
        GameSDKInternal.onConfigurationChanged(activity,newConfig)
    }
    @JvmStatic
    fun onBackPressed(activity: Activity): Boolean{
        return GameSDKInternal.onBackPressed(activity)
    }

    @JvmStatic
    fun onKeyDown(activity: Activity,keyCode: Int, event: KeyEvent?): Boolean{
        return GameSDKInternal.onKeyDown(activity,keyCode,event)
    }

}
